/*
 * BaseRoomInfoBO.java 
 * 
 * Copyright 2009 Wangfeng Beijing Inc. 
 * All rights reserved. 
 * 
 * Created on 2012-07-06
 */

package com.bjtech.domain.query;

import org.ssi.web.util.QuerySpecTpl;

import com.bjtech.web.util.SelectBean;

/**
 * 功能概述:户主信息管理 <br>
 * 
 * @author 王峰
 */

public class BaseRoomInfoQuerySpec extends SelectBean {
	/* */
	private Long id;
	/* */
	private String house_num;
	/* */
	private Long build_id;
	/* */
	private Long unit_no;
	/* */
	private Long floor_no;
	/* */
	private Long floor_pos;
	/* */
	private Long is_side;
	/* */
	private String name;
	/* */
	private String tel;
	/* */
	private String email;
	/* */
	private Float struct_area;
	/* */
	private Float hear_area;
	/* */
	private Long is_cal;
	/* */
	private Float xz_factor;
	/* */
	private Long send_bill;
	/* */
	private String demo;
	
	private String serious_num;

	@Override
	public void queryParamString() {
		StringBuilder fromPart = new StringBuilder(" where 1=1");

		if (this.isAll != null && this.isAll.intValue() != 1) {
			if (QuerySpecTpl.isValid(id)) {
				fromPart.append(" and a.id = ");
				fromPart.append(id);
			}

			if (QuerySpecTpl.isValid(house_num)) {
				fromPart.append(" and a.house_num like ");
				fromPart.append(" CONCAT('%','");
				fromPart.append(house_num);
				fromPart.append("','%')");
			}

			if (QuerySpecTpl.isValid(build_id)) {
				fromPart.append(" and a.build_id = ");
				fromPart.append(build_id);
			}

			if (QuerySpecTpl.isValid(unit_no)) {
				fromPart.append(" and a.unit_no = ");
				fromPart.append(unit_no);
			}

			if (QuerySpecTpl.isValid(floor_no)) {
				fromPart.append(" and a.floor_no = ");
				fromPart.append(floor_no);
			}
			if (QuerySpecTpl.isValid(serious_num)) {
				fromPart.append(" and a.id in (select room_id from p_assign_meter_info where serious_num='");
				fromPart.append(serious_num);
				fromPart.append("')");
			}
			if (QuerySpecTpl.isValid(floor_pos)) {
				fromPart.append(" and a.floor_pos = ");
				fromPart.append(floor_pos);
			}

			if (QuerySpecTpl.isValid(is_side)) {
				fromPart.append(" and a.is_side = ");
				fromPart.append(is_side);
			}

			if (QuerySpecTpl.isValid(name)) {
				fromPart.append(" and a.name like ");
				fromPart.append(" CONCAT('%','");
				fromPart.append(name);
				fromPart.append("','%')");
			}

			if (QuerySpecTpl.isValid(tel)) {
				fromPart.append(" and a.tel like ");
				fromPart.append(" CONCAT('%','");
				fromPart.append(tel);
				fromPart.append("','%')");
			}

			if (QuerySpecTpl.isValid(email)) {
				fromPart.append(" and a.email like ");
				fromPart.append(" CONCAT('%','");
				fromPart.append(email);
				fromPart.append("','%')");
			}

			if (QuerySpecTpl.isValid(struct_area)) {
				fromPart.append(" and a.struct_area = ");
				fromPart.append(struct_area);
			}

			if (QuerySpecTpl.isValid(hear_area)) {
				fromPart.append(" and a.hear_area = ");
				fromPart.append(hear_area);
			}

			if (QuerySpecTpl.isValid(is_cal)) {
				fromPart.append(" and a.is_cal = ");
				fromPart.append(is_cal);
			}

			if (QuerySpecTpl.isValid(xz_factor)) {
				fromPart.append(" and a.xz_factor = ");
				fromPart.append(xz_factor);
			}

			if (QuerySpecTpl.isValid(send_bill)) {
				fromPart.append(" and a.send_bill = ");
				fromPart.append(send_bill);
			}

			if (QuerySpecTpl.isValid(demo)) {
				fromPart.append(" and a.demo like ");
				fromPart.append(" CONCAT('%','");
				fromPart.append(demo);
				fromPart.append("','%')");
			}

			if (QuerySpecTpl.isValid(this.direction)
					&& QuerySpecTpl.isValid(this.sort)) {
				fromPart.append(" order by ");
				fromPart.append(this.sort);
				fromPart.append(" ");
				fromPart.append(this.direction);
			} else {
				fromPart.append(" order by ");
				fromPart.append("id");
				fromPart.append(" ");
				fromPart.append("asc");

			}
		}
		super.setQueryString(fromPart.toString());
	}

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getHouse_num() {
		return this.house_num;
	}

	public void setHouse_num(String house_num) {
		this.house_num = house_num;
	}

	public Long getBuild_id() {
		return this.build_id;
	}

	public void setBuild_id(Long build_id) {
		this.build_id = build_id;
	}

	public Long getUnit_no() {
		return this.unit_no;
	}

	public void setUnit_no(Long unit_no) {
		this.unit_no = unit_no;
	}

	public Long getFloor_no() {
		return this.floor_no;
	}

	public void setFloor_no(Long floor_no) {
		this.floor_no = floor_no;
	}

	public Long getFloor_pos() {
		return this.floor_pos;
	}

	public void setFloor_pos(Long floor_pos) {
		this.floor_pos = floor_pos;
	}

	public Long getIs_side() {
		return this.is_side;
	}

	public void setIs_side(Long is_side) {
		this.is_side = is_side;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getTel() {
		return this.tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public Float getStruct_area() {
		return this.struct_area;
	}

	public void setStruct_area(Float struct_area) {
		this.struct_area = struct_area;
	}

	public Float getHear_area() {
		return this.hear_area;
	}

	public void setHear_area(Float hear_area) {
		this.hear_area = hear_area;
	}

	public Long getIs_cal() {
		return this.is_cal;
	}

	public void setIs_cal(Long is_cal) {
		this.is_cal = is_cal;
	}

	public Float getXz_factor() {
		return this.xz_factor;
	}

	public void setXz_factor(Float xz_factor) {
		this.xz_factor = xz_factor;
	}

	public Long getSend_bill() {
		return this.send_bill;
	}

	public void setSend_bill(Long send_bill) {
		this.send_bill = send_bill;
	}

	public String getDemo() {
		return this.demo;
	}

	public void setDemo(String demo) {
		this.demo = demo;
	}

	public String getSerious_num() {
		return serious_num;
	}

	public void setSerious_num(String seriousNum) {
		serious_num = seriousNum;
	}
}
